Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add deserealization #5

Merged
merged 1 commit into from
May 22, 2024
Merged

Add deserealization #5

merged 1 commit into from
May 22, 2024

Conversation

ukorvl
Copy link
Member

@ukorvl ukorvl commented May 21, 2024

This diff adds .cjs extension to commonjs bundle. Why do we need to save build as cjs?

If you try to require() an ES module (a package with "type": "module" in its package.json), Node.js will throw an error. This is because require() is a feature of CommonJS, not ES modules.

We build package as ES Modules and as CommonJS. We have "type": "module" in the package.json, so if user wants to require package and use it is commonjs module they have an error.

We can simply avoid it by adding .cjs extension to the module file. From nodejs documentation:

Within a "type": "module" package, Node.js can be instructed to interpret a particular file as CommonJS by naming it with a .cjs extension

Also this diff:

  • Adds prototypes of deserialization methods
  • Renames Transactions to Messages

@ukorvl ukorvl self-assigned this May 21, 2024
Copy link

changeset-bot bot commented May 21, 2024

🦋 Changeset detected

Latest commit: 888d1b9

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
niljs Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@ukorvl ukorvl force-pushed the 1-add-deserealization branch from b9b18d5 to 3944c35 Compare May 21, 2024 21:24
@ukorvl ukorvl requested a review from KlonD90 May 21, 2024 21:25
@ukorvl ukorvl force-pushed the 1-add-deserealization branch from 3944c35 to 39b8565 Compare May 21, 2024 22:55
@ukorvl ukorvl force-pushed the 1-add-deserealization branch from 39b8565 to 888d1b9 Compare May 21, 2024 23:02
Copy link
Contributor

@KlonD90 KlonD90 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ukorvl ukorvl merged commit c148332 into master May 22, 2024
2 checks passed
@github-actions github-actions bot mentioned this pull request May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants